package com.guigu.www.erp.dengtao.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.www.erp.common.pojo.MDesignProcedure;
import com.guigu.www.erp.common.pojo.MDesignProcedureDetails;
import com.guigu.www.erp.common.pojo.PageVo;
import com.guigu.www.erp.dengtao.dao.MDesignProcedureDetailsMapper;
import com.guigu.www.erp.dengtao.service.MDesignProcedureDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional

public class MDesignProcedureDetailsServiceImpl implements MDesignProcedureDetailsService {
    @Autowired
    MDesignProcedureDetailsMapper mDesignProcedureDetailsMapper;

    @Override
    public String select() {
        return mDesignProcedureDetailsMapper.selectsyt();
    }

    @Override
    public void add(MDesignProcedureDetails mDesignProcedureDetails) {
        mDesignProcedureDetailsMapper.insertSelective(mDesignProcedureDetails);
    }

    @Override
    public PageVo<MDesignProcedureDetails> FindAll(String id) {
        PageHelper.startPage(1,5);

        List<MDesignProcedureDetails> mDesignProcedureList = mDesignProcedureDetailsMapper.selectcx(id);
        PageInfo<MDesignProcedureDetails> ages = new PageInfo(mDesignProcedureList);
        long total = ages.getTotal();
        List<MDesignProcedureDetails> list = ages.getList();

        return new PageVo<MDesignProcedureDetails>(total, list);

    }

    @Override
    public List<MDesignProcedureDetails> gxmx(String id) {
        return mDesignProcedureDetailsMapper.selectmxid(id);
    }

    @Override
    public void xiugai(MDesignProcedureDetails mDesignProcedureDetails) {
        mDesignProcedureDetailsMapper.xiugai(mDesignProcedureDetails);
    }

    @Override
    public List<MDesignProcedureDetails> gxwlsj(String id) {
        List<MDesignProcedureDetails> mDesignProcedureList = mDesignProcedureDetailsMapper.selectcx(id);
        return mDesignProcedureList;
    }

    @Override
    public void up(MDesignProcedureDetails m) {
        mDesignProcedureDetailsMapper.updateByPrimaryKeySelective(m);
    }

    @Override
    public void upd(MDesignProcedureDetails m) {
        mDesignProcedureDetailsMapper.updateByPrimaryKeySelective(m);
    }

    @Override
    public MDesignProcedureDetails selectAll(String id) {
        return mDesignProcedureDetailsMapper.selectByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public List<MDesignProcedureDetails> cx(String id) {
        return mDesignProcedureDetailsMapper.ckk(Integer.parseInt(id));

    }

    @Override
    public List<MDesignProcedureDetails> cxckx(int id) {
        return  mDesignProcedureDetailsMapper.ckk(id);

    }


}
